package gui.util;

import javax.swing.table.AbstractTableModel;

public class SimpleDisciplineTableModel extends AbstractTableModel {

	private String[] columnNames = {"Disciplina", "Periodo"};
	private Object[][] data;
	
	public SimpleDisciplineTableModel(Object[][] data) {
		this.data = data;
	}
	
	@Override
	public int getColumnCount() {
		
		return columnNames.length;
	}

	@Override
	public String getColumnName(int col) {
        return columnNames[col];
    }
	
	@Override
	public int getRowCount() {
		
		return data.length;
	}

	@Override
	public Object getValueAt(int line, int column) {
		return data[line][column];
	}

	@Override
	public void setValueAt(Object value, int line, int column) {
        data[line][column] = value;
        fireTableCellUpdated(line, column);
    }
	
	@Override
	public Class getColumnClass(int coluna) {
        return getValueAt(0, coluna).getClass();
    }
	
}
